import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class test01 {
    public static void main(String[] args) {
        JSONObject js0 = new JSONObject();
        JSONObject js1 = new JSONObject();
        JSONObject js2 = new JSONObject();
        List<Map<String,Object>> list = new ArrayList<>();
        Map<String, Object> map = new HashMap<>();
        js2.put("code","CA000");
        js2.put("name","李建国");
        list.add(js2);
        js1.put("data",list);
        map.put("data",js1);
        map.put("method","method");
        System.out.println("oa发送到后端的数据:"+map);


        JSONObject data1 = (JSONObject) map.get("data");
        System.out.println("抽取第一层:"+data1);


        JSONArray data2 = data1.getJSONArray("data");
        System.out.println("抽取第二层:"+data2);


        JSONObject data3 = data2.getJSONObject(0);
        System.out.println("抽取第三层:"+data3);


        Map<String, Object> map0 = new HashMap<>();
        for (Map.Entry<String, Object> entry : data3.entrySet()) {
            map0.put(entry.getKey(), entry.getValue());
        }
        System.out.println("最终抽取的map:"+map0);
    }
}
